<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>${site.name} - Powered by JavaCMS</title>
<link href="${resSys}/front.css" rel="stylesheet" type="text/css"/>
<link href="${resSys}/jqueryUI/jquery.ui.css" rel="stylesheet" type="text/css"/>
<script src="${resSys}/jquery.js" type="text/javascript"></script>
<script src="${base}/res/common/js/jquery.ext.js" type="text/javascript"></script>
<script src="${resSys}/jqueryUI/jquery-ui.js" type="text/javascript"></script>
<script src="${resSys}/front.js" type="text/javascript"></script>
<script src="${base}/thirdparty/ckeditor/ckeditor.js" type="text/javascript"></script>
<script src="${base}/res/common/js/jquery.ui.widget.js" type="text/javascript"></script>
<script src="${base}/res/common/js/jquery.iframe-transport.js" type="text/javascript"></script>
<script src="${base}/res/common/js/jquery.fileupload.js" type="text/javascript"></script>

<link rel="stylesheet" type="text/css" href="/${res}/css/index.css" />
<script type="text/javascript">
$.validator.methods.leafChannel = function(value, element, param) {
	var i = element.selectedIndex;
	return $(element.options[i]).attr("class")!="sel-disabled";
}
$(function() {
	$("#jvForm").validate({
		rules: {
			channelId: {
				required: true,
				leafChannel: true
			}
		},
		messages:{
			channelId: {
				leafChannel: "请选择末级栏目"
			}
		}
	});
	
});

</script>
<style type="text/css">
.sel-disabled{background-color:#ccc}
</style>
</head>
<body>
[#include "../include/top.html"/]
[#include "../include/header.html"/]
<div class="member-con">
  <div class="m-pos"><a href="${base}/">首页</a> > <span>会员中心</span></div>
  <div class="member clearfix">
    <div class="memberLeft clearfix"> 
      <div class="member-nav">
        <ul>
        <li><a href="${base}/member/index.jspx">个人资料</a></li>
        <li><a href="${base}/member/contribute_list.jspx" class="on">投稿管理</a></li>
        <li><a href="${base}/member/resume.jspx">应聘管理</a></li>
        <li><a href="${base}/member/mycomments.jspx">我的评论</a></li>
        <li><a href="${base}/member/myguestbook.jspx">我的留言</a></li>
        <li><a href="${base}/member/collection_list.jspx">我的收藏</a></li>
        <li><a href="${base}/member/message_mng.jspx">站内信息</a></li>
        <li><a href="${base}/member/account.jspx">服务中心</a></li>
        </ul>
      </div>
      <div class="member-main">
        <div class="member-child"><a href="${base}/member/contribute_list.jspx" class="on">稿件列表</a>|<a href="${base}/member/contribute_add.jspx">发布稿件</a></div>
        <div class="member-text tggl fbgj">
          [#if channelList?size gt 0]
          [#include "media_upload.html"/]
          [#include "image_upload.html"/]
          [#include "attachment_upload.html"/]
          <form id="jvForm" action="contribute_update.jspx" method="post">
          <table cellpadding="0" cellspacing="0">
            <tbody>
              <tr>
                <td class="tggl-top">标题</td><td><input type="text" name="title" value="${content.title!?html}" maxlength="150" class="member-change  required" style="width:300px;" /><span style="color:#f00; margin-left:10px;">*</span></td>
              </tr>
              <tr>
                <td class="tggl-top">TAGS</td><td><input type="text" name="tagStr" value="${content.tagStr!?html}" maxlength="255" class="member-change" style="width:300px;" /><span style=" margin-left:10px;">用 , 分割</span></td>
              </tr>
              <tr>
                <td class="tggl-top">作者</td><td><input type="text" name="author" value="${content.author!?html}" maxlength="100" class="member-change" /></td>
              </tr>
              <tr>
                <td class="tggl-top">栏目</td>
                <td>
                <select name="channelId" class="member-change">
                <option value="" class="sel-disabled">--请选择--</option>
                [#if channelList?size gt 0]
                    [#assign origDeep=channelList[0].deep+1/]
                    [#list channelList as c]
                    <option value="${c.id}"[#if c.child?size gt 0] class="sel-disabled"[/#if][#if content.channel.id==c.id]selected="selected"[/#if]>[#if c.deep gte origDeep][#list origDeep..c.deep as i]&nbsp;&nbsp;[/#list]>[/#if]${c.name}</option>
                [/#list]
                [/#if]
                </select>
                </td>
              </tr>
              <tr>
                <td class="tggl-top">摘要</td><td><textarea name="description" rows="3" cols="70" maxlength="255">${content.description!?html}</textarea></td>
              </tr>
              <tr>
                <td class="tggl-top">收费设置</td>
                <td>
                	免费:<input name="charge" value="0" [#if content.chargeModel==0]checked="checked"[/#if] onclick="changeModel()" type="radio"/>
                	收费:<input name="charge" value="1" [#if content.chargeModel==1]checked="checked"[/#if] onclick="changeModel()" type="radio"/>
					打赏:<input name="charge" value="2" [#if content.chargeModel==2]checked="checked"[/#if] onclick="changeModel()" type="radio"/>
					<span id="chargeAmountSpan">金额:<input type="text" name="chargeAmount" value="${content.chargeAmount!}" required="true" class="required number" maxlength="10" style="width:100px"/></span>
					<span id="rewardSpan">
					随机:<input name="rewardPattern" value="false"  type="radio" required="true" [#if !content.rewardPattern]checked="checked"[/#if] onclick="changePattern()"/>
					固定:<input name="rewardPattern" value="true"  type="radio" required="true"  [#if content.rewardPattern]checked="checked"[/#if] onclick="changePattern()"/>
					<div id="rewardFixDiv">
					固定:
					[#if content.rewardFixs??&&content.rewardFixs?size gt 0]
					[#list content.rewardFixs as fix]
					<input type="text" name="rewardFix" value="${fix.fixVal!}" required="true" class="required number" maxlength="10" style="width:50px"/>
					[/#list]
					[#else]
					[#list config.rewardFixAttr?keys?sort as fix]
					<input type="text" name="rewardFix" value="${config.rewardFixAttr[fix]!}" required="true" class="required number" maxlength="10" style="width:50px"/>
					[/#list]
					[/#if]
					</div>
					<div id="rewardRandomDiv">
					随机范围:
					[#if content.rewardRandomMin!=0]
					<input type="text" name="rewardRandomMin" value="${content.rewardRandomMin!}" required="true" class="required number" maxlength="10" style="width:50px"/>
					[#else]
					<input type="text" name="rewardRandomMin" value="${contentChargeConfig.rewardMin!}" required="true" class="required number" maxlength="10" style="width:50px"/>
					[/#if]
					[#if content.rewardRandomMax!=0]
					<input type="text" name="rewardRandomMax" value="${content.rewardRandomMax!}" required="true" class="required number" maxlength="10" style="width:50px"/>
					[#else]
					<input type="text" name="rewardRandomMax" value="${contentChargeConfig.rewardMax!}" required="true" class="required number" maxlength="10" style="width:50px"/>
					[/#if]
					</div>
					</span>
                </td>
              </tr>
              <tr>
                <td class="tggl-top">多媒体</td>
                <td style="padding:10px 5px;">
                  <div>
						<input type="text" id="mediaPath" name="mediaPath" value="${content.mediaPath!}" class="member-change" style="width:303px"/>
					</div>
					<div>
						<span id="mfc" style="position:relative;display:block;line-height:28px;margin-top:4px;">
						<input type='text' id='mediaFileText' class="member-change" style="float:left;margin-left:15px;"/>  
						<input class="change-Btn" type='button' value='浏览' style="float:left;margin-left:4px;" />
						<input onchange="$('#mediaFileText').val(this.value)" size="19" type="file" name="mediaFile" id="mediaFile" style="height:28px;width:246px;opacity:0;filter:alpha(opacity=0);position:absolute;left:15px;top:0;"/>
						<input type="button" value="上传" onclick="uploadMedia();" class="change-Btn"  style="float:left;"/>
						</span> 
					</div>
                </td>
              </tr>
              <tr>
                <td class="tggl-top">播放器</td><td>[@p.radio name="mediaType" list=["WM","REAL","FLV","FLASH","CK"] value="${content.mediaType!}"/]</td>
              </tr>
              <tr>
                <td class="tggl-top">内容</td>
                <td>
                 <textarea id="txt" name="txt">${content.txt!}</textarea> 
                 <script type="text/javascript">
					$(function() {
					   	CKEDITOR.replace( 'txt' ,
					   			{
							   		filebrowserUploadUrl : '${base}/fck/upload.jspx',  
							   		filebrowserImageUploadUrl : '${base}/fck/upload.jspx?Type=Image',  
							   		filebrowserFlashUploadUrl : '${base}/fck/upload.jspx?Type=Flash',
							   		filebrowserMediaUploadURL : '${base}/fck/upload.jspx?Type=Media'
					   		     }
					   	);  
					 });
				</script>
                 </select>
                </td>
              </tr>
              <tr>
                <td class="tggl-top">附件</td>
                <td style="padding:10px 5px;">
                  <div>
		
					<input type="button" style="width:40px;height:24px;cursor:pointer;background:#3694d7;color:#fff;font-size:12px;cursor:pointer;" id="fileupload" value="上传"/>
					<input id="docfileupload" style='display:none' type="file" name="Filedata" data-url="o_swfAttachsUpload.jspx" multiple>			
					<script>		
					$(function () {
						$('#fileupload').click(function(){						
							$('#docfileupload').trigger('click');
						})
										
						$('#docfileupload').fileupload({
					        dataType: 'json',
					        add: function (e, data) {
					            data.submit();				         
					        },
					        done: function (e, data) {				         	           
					            addAttachLine();
						   		var index = attachIndex - 1;
						   		$("#attachmentPaths"+index).val(data.result.attachUrl);
						   		$("#attachmentNames"+index).val(data.result.attachName);		           					           
					       	 },
							progressall: function (e, data) {
								$("#submit").prop("disabled","disabled");
							}
					    });
					});
					</script>
					
					<span style="display: none;"><input class="cancel" id="abtnCancel" type="button" value="取消" onclick="swfu.cancelQueue();" disabled="disabled" /></span>
					<div id="afsUploadProgress" style="display: none;"></div>
					</div>
					<table id="attachTable" border="0" class="fbgj-fj">
					<tr>					
						<td align="center">附件名称</td>
						<td align="center">路径</td>
						<td align="center">上传</td>
                                                <td align="center"></td>
					</tr>
                                        [#list content.attachments as attach]
                                        <tr id="attachTr${attach_index}" style="height:50px;">					
						<td align="center"><input type="text" id="attachmentNames${attach_index}" name="attachmentNames" value="${attach.name!}"/></td>
						<td align="center"><input type="text" id="attachmentPaths${attach_index}" name="attachmentPaths" value="${attach.path!}"/></td>
						<td align="center"><span id="afc${attach_index}" style="position:relative;display:block;width:100px;">
									<input type='text' id='attachmentText${attach_index}'  style="position:absolute;right:120px;width:180px;top:20px;border:1px solid #c7c7c7;"/>  
									<input onchange="$('#attachmentText${attach_index}').val(this.value)" size="19" type="file" name="attachmentFile" id="attachmentFile${attach_index}" style="width:180px;height:24px;opacity:0;filter:alpha(opacity=0);position:absolute;right:120px;border:1px solid #c7c7c7;top:0;"/>
									<input type="button" value="上传" onclick="uploadAttachment(${attach_index});" class="upload-button"/>
									</span>
									<input type="hidden" id="attachmentFilenames${attach_index}" name="attachmentFilenames" value="${attach.filename!}"/></td>
                                                <td align="center"><a onclick="$('#attachTr${attach_index}').remove();" href="javascript:void(0);" class="pn-opt">删除</a></td>
					</tr>
                                        [/#list]
					</table>
					<textarea id="attachTr" style="display:none">
					<tr id="attachTr{0}">
						
						<td align="center"><input type="text" id="attachmentNames{0}" name="attachmentNames" class="member-change" style="width:100px;height:24px;"/></td>
						<td align="center"><input type="text" id="attachmentPaths{0}" name="attachmentPaths" class="member-change" style="width:130px;height:24px;"/></td>
						<td align="center">
							<span id="afc{0}" style="position:relative;display:block;width:200px;">
							<input type='text' id='attachmentText{0}' class="member-change" style="width:150px;height:24px;" />  
							<input onchange="$('#attachmentText{0}').val(this.value)" size="19" type="file" name="attachmentFile" id="attachmentFile{0}" style="height:24px;width:200px;opacity:0;filter:alpha(opacity=0);position:absolute;left:0;top:0;"/>
							<input type="button" value="上传" onclick="uploadAttachment({0});" style="width:40px;height:24px;cursor:pointer;background:#3694d7;color:#fff;font-size:12px;cursor:pointer;" />
							</span>
							<input type="hidden" id="attachmentFilenames{0}" name="attachmentFilenames"/>
						</td>
                                                <td align="center" width="50"><a onclick="$('#attachTr{0}').remove();" href="javascript:void(0);" class="pn-opt">删除</a></td>
					</tr>   
					</textarea>
					<script type="text/javascript">
							var attachIndex = ${content.attachments?size};
							var attachTpl = $.format($("#attachTr").val());
							function addAttachLine() {
								$('#attachTable').append(attachTpl(attachIndex++));
							}
							</script>
                </td>
              </tr>
              <tr>
                <td class="tggl-top">图片集</td>
                <td style="padding:10px 5px;">
                  <div>
						
						<input type="button" style="width:40px;height:24px;cursor:pointer;background:#3694d7;color:#fff;font-size:12px;cursor:pointer;" id="fileupload1" value="上传"/>
						<input id="docfileupload1" style='display:none' type="file" name="Filedata" data-url="o_swfPicsUpload.jspx" multiple>			
						<script>		
						$(function () {
							$('#fileupload1').click(function(){						
								$('#docfileupload1').trigger('click');
							})
											
							$('#docfileupload1').fileupload({
						        dataType: 'json',
						        add: function (e, data) {
						            data.submit();				         
						        },
						        done: function (e, data) {				         	           			           							   		
							   		addPicLine();
									var index = picIndex - 1;
									imgUrl=data.result.imgUrl;
									$("#preImg"+index).attr("src",""+imgUrl);
									var imgSrc = parent.document.getElementById("preImg"+index);
									if(!$(imgSrc).attr("noResize")) {
										$(imgSrc).css("width","auto");
										$(imgSrc).css("height","auto");
									}
									$("#uploadImgPath"+index).val(imgUrl);							   									   		
						       	 },
								progressall: function (e, data) {
									$("#submit").prop("disabled","disabled");
								}
						    });
						});
						</script>	
						
						
						
						<span style="display: none;"><input class="cancel" id="btnCancel" type="button" value="取消" onclick="swfu.cancelQueue();" disabled="disabled" /></span>
						<div id="fsUploadProgress" style="display: none;"></div>
						</div>
                                                 [#list content.pictures as p]
						<table id="picTable${p_index+3}" border="0" 

style="float:left;">
						<tr>
							<td>
								<div><input type="text" id="uploadImgPath${p_index+3}" name="picPaths" value="${p.imgPath}" style="width:170px"/> <a href="javascript:void(0);" onclick="$('#picTable${p_index+3}').remove();" class="pn-opt">删除</a></div>
								<div>
								<span id="ufc${p_index+3}" style="position:relative">
								<input type='text' id='uploadFileText${p_index+3}' size="10" style="border:1px solid #c7c7c7;" />  
								<input onchange="$('#uploadFileText${p_index+3}').val(this.value)" size="10" type="file" id="uploadFile${p_index+3}" class="file-button" style="width:200px;"/>
								</span> 
								<input type="button" value="上传" onclick="upload(${p_index+3});" class="upload-button"/>
								</div>
								<div><textarea style="width:200px;height:60px;" name="picDescs" maxlength="255">${p.description!}</textarea></div>
							</td>
							<td><img id="preImg${p_index+3}" src="${p.imgPath!}" alt="预览" noResize="true" style="width:110px;height:110px;background-color:#ccc;border:1px solid #333"/></td>
						</tr>
						</table>
						[/#list]
						<div id="picBefore" style="clear:both"></div>
						<div id="picTable" style="display:none;">
						<table id="picTable{0}" border="0" cellpadding="0" cellspacing="0" class="fbgj-tab">
						<tr>
							<td style="line-height:1;">
								<div><input type="text" id="uploadImgPath{0}" name="picPaths" class="member-change" /> <a href="javascript:void(0);" onclick="$('#picTable{0}').remove();" class="pn-opt">删除</a></div>
								<div style="margin-top:4px;">
								<span id="ufc{0}" style="position:relative;">
								<input type='text' id='uploadFileText{0}' size="10" class="member-change" style="width:115px;height:22px;"/>  
								<input onchange="$('#uploadFileText{0}').val(this.value)" size="10" type="file" id="uploadFile{0}" style="width:72px;height:22px;"/>
								</span>
								<input type="button" value="上传" onclick="upload({0});" style="width:50px;height:22px;cursor:pointer;background:#3694d7;color:#fff;font-size:12px;"/>
								</div>
								<div><textarea style="width:300px;height:60px;margin-bottom:0;" name="picDescs" maxlength="255"></textarea></div>
							</td>
							<td><img id="preImg{0}" alt="预览" noResize="true" style="width:110px;height:110px;background-color:#ccc;border:1px solid #c7c7c7;"/></td>
						</tr>
						</table>
						</div>
						<script type="text/javascript">
						var picIndex = ${content.pictures?size} ;
						var picTpl = $.format($("#picTable").html

());
						function addPicLine() {
							$('#picBefore').before(picTpl

(picIndex++));
						}
						</script>
                </td>
              </tr>
              [#if contentChargeModel??&&contentChargeModel==2]
               <tr>
                    <td class="tggl-top">收费金额：</td>
                    <td>
                    	<input name="charge" value="true" type="hidden"/>
                   		<input type="text" name="chargeAmount" value=${content.chargeAmount!} maxlength="20" class="member-change"/> 
                    </td>
               </tr>
               [/#if]
              <tr>
                <td colspan="2" style="text-align:center; padding:20px 0;">
                <input type="hidden" name="nextUrl" value="contribute_list.jspx"/>
                    <input type="hidden" name="id" value="${content.id}"/>
                <input type="submit" class="member-submit" value="提交" />
                <input type="reset" class="member-reset" value="重置" />
                </td>
              </tr>
            </tbody>
          </table>
          </form>
            [#else]
            <div>系统不允许投稿，请联系管理员！</div>
            [/#if]
        </div>
      </div>
    </div>
    [#include "../include/member-right.html" /]
    <div class="m-sj"></div>
  </div>
</div>
[#include "../include/footer.html"/]
</body>
</html>